package com.hzy.service.impl;

import com.hzy.dao.SupplierMapper;
import com.hzy.pojo.Supplier;
import com.hzy.service.SupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Package: com.hzy.service.impl
 * @ClassName: SupplierServiceImpl
 * @Author: 862982795
 * @CreateTime: 2021/07/12 16:17
 * @Description:供货商业务层接口,实现
 */
@Transactional
@Service("supplierService")
public class SupplierServiceImpl implements SupplierService {
    @Autowired
    private SupplierMapper supplierMapper;
    @Override
    public List<Supplier> getListSupplier(Supplier supplier) {
        try {
            return supplierMapper.getListSupplier(supplier);
        }catch (RuntimeException e){
            e.printStackTrace();
            throw e;
        }
    }

    @Override
    public Integer addSupplier(Supplier supplier) {
        return supplierMapper.addSupplier(supplier);
    }

    @Override
    public Integer deleteSupplier(Integer id) {
        return supplierMapper.deleteSupplier(id);
    }

    @Override
    public Integer updateSupplier(Supplier supplier) {
        return supplierMapper.updateSupplier(supplier);
    }

    public SupplierMapper getSupplierMapper() {
        return supplierMapper;
    }

    public void setSupplierMapper(SupplierMapper supplierMapper) {
        this.supplierMapper = supplierMapper;
    }
}
